package com.itheima.health.dao;

import com.itheima.health.pojo.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderDao {

    /**
     * 插入
     * @param order
     */
    void insert(Order order);

    /**
     * 根据会员，套餐，日志进行查询
     * @param memberId
     * @param orderDate
     * @param setmealId
     * @return
     */
    long countByMemberAndDateAndSetMeal(@Param("memberId") Integer memberId,
                                        @Param("orderDate") Date orderDate,
                                        @Param("setmealId") Integer setmealId);

    /**
     * 根据ID查询
     * @param id
     * @return
     */
    Order selectById(@Param("id") Integer id);

    Long countByOrderDateRange(@Param("starDate") Date starDate, @Param("endDate") Date endDate, @Param("status") String status);

    List<Map<String,Object>> countByHotSetMeal(@Param("topN") int topN);

}
